﻿@model BackEnd.Models.AdminMenuModel
@{
    ViewBag.Title = "Update Menu";
}

  <h2>Update Menu</h2>
    @using (Html.BeginForm()) {
        @Html.ValidationSummary(true, "Menu update was unsuccessful. Please correct the errors and try again.", new { @class="error_box" })
                        
        if(ViewData["ErrorMessage"]!=null){
         @Html.Label(ViewData["ErrorMessage"].ToString())
         }
        <div>
                           
                @Html.HiddenFor(m => m.MenuID)                        
                <table>
                    <tr>
                        <td class="editor-label">
                            @Html.LabelFor(m => m.Code) 
                        </td>
                        <td class="editor-field">
                            @Html.TextBoxFor(m => m.Code) 
                            @Html.ValidationMessageFor(m => m.Code)
                        </td>
                    </tr>
                        <tr>
                        <td class="editor-label">
                            @Html.LabelFor(m => m.Name) 
                        </td>
                        <td class="editor-field">
                            @Html.TextBoxFor(m => m.Name)
                            @Html.ValidationMessageFor(m => m.Name)
                        </td>
                    </tr>
                    <tr>
                        <td class="editor-label">
                            @Html.LabelFor(m => m.Url) 
                        </td>
                        <td class="editor-field">
                            @Html.TextBoxFor(m => m.Url)
                            @Html.ValidationMessageFor(m => m.Url)
                        </td>
                    </tr>
                    <tr>
                        <td class="editor-label">
                            @Html.LabelFor(m => m.OrderNo) 
                        </td>
                        <td class="editor-field">
                            @Html.TextBoxFor(m => m.OrderNo)
                            @Html.ValidationMessageFor(m => m.OrderNo)
                        </td>
                    </tr>
                    <tr>
                        <td class="editor-label">
                            @Html.LabelFor(m => m.ParentID) 
                        </td>
                            <td class="editor-field">
                            @{var lstMenu = ViewData["ListMenu"] as System.Collections.IEnumerable; }
                            @Html.DropDownListFor(m => m.ParentID, new SelectList(lstMenu, "MenuID", "Code"), new { id = "ddlMenu" })
                            @Html.ValidationMessageFor(m => m.ParentID)
                 
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <img class="NFButtonLeft NFh" src="/Content/Img/0.png"><input type="submit" class="NFButton NFh" value="Update" /><img class="NFButtonRight NFh" src="/Content/Img/0.png"> @Html.ActionLink("Back","Index")
                        </td>
                    </tr>
                </table>
            
        </div>
    }